function defineVal(obj,key) {
    Object.defineProperty(obj,key,{
        set(v) {
            console.log("val的值被修改："+v);
        },
        get() {
            console.log("val的值被获取");
        }
    })
}

var person={};
person.name='123';
defineVal(person,'name');
person.name='456';
console.log(person);
console.log(person.name);
